/**
 *
 *    // ============================================
 *                    col_name1     |   col_name2     |   col_name3
 *    ------------------------------------------------------------------
 *    BzDB_row_t  [   BzDB_value_t  ,  BzDB_value_t   ,  BzDB_value_t ]
 *    BzDB_row_t  [   BzDB_value_t  ,  BzDB_value_t   ,  BzDB_value_t ]
 *    BzDB_row_t  [   BzDB_value_t  ,  BzDB_value_t   ,  BzDB_value_t ]
 *    BzDB_row_t  [   BzDB_value_t  ,  BzDB_value_t   ,  BzDB_value_t ]
 *
 *    url: https://gitee.com/banzhen/BzDB
 *
 *    // ============================================
 *         BzDB_value_t
 *         {
 *              BzDB_String_t   valuestring
 *              BzDB_Integer_t  valueint
 *         }
 *
 *
 */

#include <cstring>
#include "BzDB_demo.h"
#include "stdio.h"
#include <stdio.h>
#include <string.h>

// 每行最大长度
#define LINE_MAX 1024

#include "BzDB/utils/BzDB_file_operate.h"
#include "BzDB/utils/BzDB_array_operate.h"
#include "BzDB/utils/BzDB_string_operate.h"
#include "BzDB/BzDB.h"
#include "BzDB/utils/BzDB_binary_operate.h"
#include "BzDB/bean/BzDB_BzArray_t.h"
#include "BzDB/bean/BzDB_BzMap_t.h"
#include "BzDB/3rd_utils/cJSON/cJSON.h"
#include "BzDB/3rd_utils/cJSON/cJSON_demo.h"


int main()
{

    BzDB_demo_code_input_from_txt();
//    BzDB_demo_code_input_from_json();

//    cJSON_demo();

#if 0
    // 字符串的操作
    const char * msg = "zhendeshiniya";
    char res[20];
    BzDB_string_sub(msg ,0 , 4, res);
    printf("%s\n",res);


    int find_index = BzDB_string_find_first(msg, "de",0);
    printf("%d\n",find_index);
//
    printf("================\n");
    int index_list[5];
    int count = 0;
    BzDB_string_find_all("meilimao||haoxiaoma||meilimao||amagi","meilimao",index_list,&count);
    for(int i = 0 ; i < count ; i++){
       printf("%d\n",index_list[i]);
    }
////
    printf("**********************\n");
//    注：替换的字符（str_before)长度最多254
    char res2[1000];
    BzDB_string_replace("amagi||meilimao||meilimao", "meilimao", "haoxiaoma",res2);
    printf("%s\n",res2);
////
    printf("&&&&&&&&&&&&&&&&&&&&&&&\n");
    const char * str3 = "||amagi||meilimao||zaobaoying||younikudeshihou||";
    const char * split_str = "||";
    int start_index_list[20] = {0};
    int end_index_list[20] = {0};
    int len = 0;
    BzDB_string_split(str3, split_str , start_index_list,end_index_list,&len);
    for(int i = 0 ; i < len ; i++){
        char temp[255] = {0};
        BzDB_string_sub(str3,start_index_list[i],end_index_list[i],temp);
        printf("%s **\n",temp);
    }
////
    printf("***************************\n");
    char buf[2000] = {0};
    BzDB_file_operate_read_content("./1.txt",buf,2000);
    int s_list[50] = {0};
    int s_len = 0;
    int e_list[50] = {0};
    BzDB_string_split(buf,"\n",s_list,e_list,&s_len);
    for(int i = 0 ; i < s_len ; i++){
        char temp_str[200];
        BzDB_string_sub(buf,s_list[i],e_list[i],temp_str);
        printf("%s=\n",temp_str);
    }
//

    printf("**********\n");
    BzDB_file_operate_demo2();
#endif





//    BzDB_BzArray_demo();
//    BzDB_BzMap_demo();



//    int arr[] = {1,2,3,4,5};
//    BzDB_array_forEach(arr,5,myPrintf);


//    BzDB_code_demo();
//    BzDB_code_demo_delete();
//    BzDB_code_demo_update();
//    BzDB_code_demo_update2();
//    BzDB_code_demo_update3();
//    BzDB_code_demo_save();
//    BzDB_code_demo_read();
//    BzDB_code_demo_select_by_condition();

//    BzDB_file_operate_demo2();

    printf("right by bz");
    return 0;
}